var express = require('express');
var router = express.Router();
var userDao = require('../dao/userDao')

// var multer  = require('multer')
// var upload = multer({ dest: './public/files' })
/**
 * 用户增加的路由控制接口
 */
router.get('/', function(req, res, next) {
    res.render('users', { title: '' });
});

router.post('/findAllAction', function(req, res, next) {
    userDao.findAllAction(req,res,next)
});

router.post('/findOneAction',function(req,res,next){
    // console.log(req.body)
    userDao.findOneAction(req,res,next)
});

router.post('/addUserAction',function(req,res,next){
    // console.log(req.body)
    userDao.addUserAction(req,res,next)
});

router.post('/deleteUserById',function(req,res,next){
    // console.log(req.body)
    userDao.deleteUserById(req,res,next)
});

router.post('/updateOneInfoAction',function(req,res,next){
    // console.log(req.body)
    userDao.updateOneInfoAction(req,res,next)
});

router.get('/findAllType',function(req,res,next){
    // console.log(req.body)
    userDao.findAllType(req,res,next)
});

router.post('/uploader',function(req,res,next){
    userDao.uploader(req,res,next)
});

router.all('/up', function(req, res, next){
    userDao.up(req,res,next)
})

router.post('/findAllApply', function(req, res, next){
    userDao.findAllApply(req,res,next)
})

router.get('/findAllApply', function(req, res, next){
    res.render('application', { title: '审核代理' });
})

router.post('/findOneByInvi', function(req, res, next){
    userDao.findOneByInvi(req,res,next)
})

router.post('/findPid', function(req, res, next){
    userDao.findPid(req,res,next)
})

router.post('/updateDiscount', function(req, res, next){
    userDao.updateDiscount(req,res,next)
})
router.post('/login', function(req, res, next){
    userDao.login(req,res,next)
})
router.post('/persent', function(req, res, next){
    userDao.persent(req,res,next)
})
router.post('/persent1', function(req, res, next){
    userDao.persent1(req,res,next)
})
router.post('/persent2', function(req, res, next){
    userDao.persent2(req,res,next)
})
router.post('/persent3', function(req, res, next){
    userDao.persent3(req,res,next)
})
router.post('/persent4', function(req, res, next){
    userDao.persent4(req,res,next)
})

module.exports = router;
